<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="Application">
  <my-alert @myclick="appfunc" title="按钮1"></my-alert>
  <my-alert @myclick="appfunc" title="按钮2"></my-alert>
</div>
<script>
    const App=Vue.createApp({
        methods:{
            appfunc(param){
                console.log("单击了自定义组件："+param)
            }
        }
    })
  const alertCompent={
        data(){
            return{
                msg:"警告框提示",
                count:0
            }
        },
      methods:{
            click(){
               alert(this.msg+this.count++)
            }
      },
      props:["title"],
      template:`
        <div>
          <button @click="$emit('myclick',title)">{{ title }}</button>
        </div>
      `

  }
    App.component("my-alert",alertCompent)
    App.mount("#Application")
</script>
</body>
</html>
